package com.kanshu.client.ui.base;

import android.widget.AdapterView;
import android.widget.ListView;

import com.kanshu.client.R;
import com.kanshu.client.model.menu.MenuItem;
import com.kanshu.client.widget.adapter.menu.MenuAdapter;

import java.util.List;

import butterknife.BindView;


public abstract class BaseMenuActivity extends BaseActivity implements AdapterView.OnItemClickListener {

    @BindView(R.id.lv_menu)
    ListView lvMenu;

    @Override
    protected int provideLayoutResId() {
        return R.layout.activity_list_view;
    }


    @Override
    protected void init() {
        super.init();
        initView();
    }

    private void initView() {
        List<? extends MenuItem> menuItems = provideMenuData();
        MenuAdapter menuAdapter = new MenuAdapter<>(this, menuItems);
        lvMenu.setOnItemClickListener(this);
        lvMenu.setAdapter(menuAdapter);
    }

    protected abstract List<? extends MenuItem> provideMenuData();


}
